import { NetWorkService } from "../../apiNetworkServices"

export type BookingState = {
  start_date?: string
  end_date?: string
}

/**
 * Network request used to get appointment withIn the dates given
 * @returns the response success or error
 */

const getSpecificTimeAppointments = (params?: BookingState) => {
  return new Promise((resolve, reject) => {
    NetWorkService.Get({
      url: `/api/calendar-list?offset=0&limit=100&start_date=${params?.start_date}&end_date=${params?.end_date}`,
    })
      .then((res) => {
        resolve(res)
      })
      .catch((error) => reject(error))
  })
}

/**
 * Network request used to get appointment withIn the dates given
 * @returns the response success or error
 */

const getAppointmentDetails = (params?: any) => {
  return new Promise((resolve, reject) => {
    NetWorkService.Get({
      url: `/api/calendar-list/${params}`,
    })
      .then((res) => {
        resolve(res)
      })
      .catch((error) => reject(error))
  })
}

export { getSpecificTimeAppointments, getAppointmentDetails }
